<?php


namespace app\data\model;


use think\admin\Model;

class DataMember extends Model
{
    public function getGenderAttr($value)
    {
        $status = [0=>'未知',1=>'男',2=>'女'];
        return $status[$value];
    }
    public function cats()
    {
        return $this->hasMany(DataCat::class,'member_id');
    }
    public function devices()
    {
        return $this->hasMany(DataDevice::class,'member_id');
    }
    public function get_by_id($member_id){
       return $this->with(['cats','devices'])
           ->where(['id'=>$member_id])
           ->order('create_at desc')->select();
    }
}
